]>
Commit | Line | Data |
---|---|---|
63a61ee2 BB |
1 | using System; |
2 | using System.Collections.Generic; | |
3 | using System.Linq; | |
4 | using System.Text; | |
5 | using Microsoft.Xna.Framework; | |
95d7601b | 6 | using Microsoft.Xna.Framework.Content; |
63a61ee2 BB |
7 | using Microsoft.Xna.Framework.Graphics; |
8 | ||
9 | namespace SuperPolarity | |
10 | { | |
f8aec187 | 11 | class MainShip : Ship |
63a61ee2 | 12 | { |
f8aec187 BB |
13 | |
14 | uint Multiplier; | |
15 | uint Lives; | |
16 | uint Score; | |
95d7601b BB |
17 | ParticleEngine particleEngine; |
18 | ||
f8aec187 | 19 | public override void Initialize(ContentManager Content, Texture2D texture, Vector2 position) |
63a61ee2 | 20 | { |
f8aec187 | 21 | base.Initialize(Content, texture, position); |
63a61ee2 | 22 | |
63a61ee2 BB |
23 | Multiplier = 1; |
24 | Lives = 3; | |
25 | Score = 0; | |
95d7601b | 26 | |
95d7601b BB |
27 | List<Texture2D> texturesList = new List<Texture2D>(); |
28 | texturesList.Add(Content.Load<Texture2D>("Graphics\\circle")); | |
29 | texturesList.Add(Content.Load<Texture2D>("Graphics\\diamond")); | |
30 | texturesList.Add(Content.Load<Texture2D>("Graphics\\star")); | |
31 | ||
32 | particleEngine = new ParticleEngine(texturesList, Position); | |
33 | ||
34 | BindInput(); | |
35 | } | |
36 | ||
37 | void BindInput() | |
38 | { | |
39 | InputController.Bind("moveX", HandleHorizontalMovement); | |
40 | InputController.Bind("moveY", HandleVerticalMovement); | |
41 | } | |
42 | ||
43 | public void HandleHorizontalMovement(float value) | |
44 | { | |
45 | Acceleration.X = value * AccelerationRate; | |
46 | } | |
47 | ||
48 | public void HandleVerticalMovement(float value) | |
49 | { | |
50 | Acceleration.Y = value * AccelerationRate; | |
51 | } | |
52 | ||
f8aec187 | 53 | public override void Update(GameTime gameTime) |
95d7601b | 54 | { |
f8aec187 | 55 | base.Update(gameTime); |
95d7601b BB |
56 | particleEngine.EmitterLocation = Position; |
57 | particleEngine.Update(); | |
58 | } | |
59 | ||
f8aec187 | 60 | public override void Draw(SpriteBatch spriteBatch) |
63a61ee2 | 61 | { |
95d7601b | 62 | particleEngine.Draw(spriteBatch); |
f8aec187 | 63 | base.Draw(spriteBatch); |
63a61ee2 BB |
64 | } |
65 | } | |
66 | } |